<%@page import="com.iamteer.contact.entity.Contact"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset='UTF-8'>
		<title>所有联系人</title>
		<style type='text/css'>
			/*文字居中*/
			table td{
				text-align: center;
			}
			/*合并表格边框*/
			table{
				border-collapse: collapse;
			}
		</style>
	</head>
	<body>
		<center><h3>所有联系人(JSP)</h3></center>
		<table align='center' border='1'>
			<tr>
				<th>编号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>年龄</th>
				<th>电话</th>
				<th>QQ</th>
				<th>邮箱</th>
				<th>操作</th>
			</tr>	
			<%
				List<Contact> list = (List<Contact>)request.getAttribute("contacts");
				if (list != null) {
					for (Contact contact : list) {
			%>
			<tr>
				<td><%=contact.getId() %></td>
				<td><%=contact.getName() %></td>
				<td><%=contact.getGender() %></td>
				<td><%=contact.getAge() %></td>
				<td><%=contact.getPhone() %></td>
				<td><%=contact.getEmail() %></td>
				<td><%=contact.getQq() %></td>
				<td>
				<%
					String updatePath = "/day13Contact/QueryContact?" + contact.getId(); 
					String deletePath = "/day13Contact/DeleteContact?" + contact.getId(); 
				%>
					<a href=<%=updatePath %>>修改</a>&nbsp;&nbsp;
					<a href=<%=deletePath %>>删除</a>
				</td>
			</tr>
			<%
					}
				}
			%>
			<tr>
				<td colspan='8'><a href='addContact.html'>[添加联系人]</td>
			</tr>
		</table>
		
	</body>
</html>